home *** CD-ROM | disk | FTP | other *** search
- From: root@205.218.34.39 (where is my fish?)
- Subject: Re: C calling C++ function????
- Newsgroups: comp.lang.c++
- References: <4g07q4$doh@ornews.intel.com> <4g50u7$fcp@izar.brunel.ac.uk>
- Reply-To: wjl@sisna.com
- X-Newsreader: TIN [version 1.2 PL2]
- NNTP-Posting-Host: dialup1339.sisna.com
- Message-ID: <313fd401.0@news.sisna.com>
- Date: 8 Mar 96 06:30:25 GMT
- Path: 205.218.34.39!root
-
- Francesco Fantauzzi (mapgfgf@brunel.ac.uk) wrote:
- : Chad_Bryant@ccm.fm.intel.com (Chad Bryant) wrote:
- : >I've got a c program and I want to use a c++ function that I have
- : >written. What do I need to do?
- : >please reply to Chad_Bryant@ccm.fm.intel.com
-
- : Call it.
-
- : Francesco G. Fantauzzi
-
- Too bad it's not always that easy. Most C++ compilers to name mangling on the
- functions, so you can't just "call it." The way to get arround this is to
- declare the C++ function like this:
-
- extern "C" {
- int my_c++_function();
- void my_ther_c++_function();
- }
-
- and so forth. This stops the compiler from using name mangling, but watch out!
- You can't overload two "C" functions with the same name--as name mangling is
- the only way overloading can work. :)
-
- --
- where is my fish?
- wjl@sisna.com
- wjl@blarg.net
- wjl@byu.edu
-